package com.example.haoqisystem.controller;

import com.example.haoqisystem.request.EmailRequest;
import com.example.haoqisystem.response.BaseResponse;
import com.example.haoqisystem.service.EmailService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Api(tags = "邮件服务Api")
@RequestMapping("/email")
@RequiredArgsConstructor(onConstructor_ = {@Autowired})
public class EmailController {
    private final EmailService emailService;

    @ApiOperation(value = "发送邮件")
    @PostMapping("/sendEmail")
    public BaseResponse<String> sendEmail(@RequestBody EmailRequest request){
        return emailService.sendEmail(request);
    }
}
